package com.rising.spring.main;


import com.rising.spring.aop.MainConfigOfAop;
import com.rising.spring.service.AopServiceImpl;
import com.rising.spring.service.FruitService;
import com.rising.spring.service.impl.FruitServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest2 {
    public static void main(String[] args) {
        //ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext2.xml");
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfigOfAop.class);
        FruitService fruitService2 = ctx.getBean(FruitService.class);
        AopServiceImpl aopServiceImpl = ctx.getBean(AopServiceImpl.class);
        fruitService2.eatFruit();
        System.out.println("-------------------------------------------");
        aopServiceImpl.pringName("你好");
    }
}
